﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Bitirme.DAL.Entities
{
    public class WorkPath
    {
        private List<WorkPackage> _WorkPackages;
        private int _ManHour;
        public List<WorkPackage> tempWorkPackages;
        public WorkPath() { 
        
            _WorkPackages = new List<WorkPackage>();
            _ManHour = 0;
            tempWorkPackages = new List<WorkPackage>();
            
        }
        public WorkPath(List<WorkPackage> workpackages) {

            _WorkPackages = new List<WorkPackage>();
            foreach (WorkPackage tempWorkPackage in workpackages) { 
                _WorkPackages.Add(tempWorkPackage);
                _ManHour += tempWorkPackage.Requirement.ManHour;
            }
        }
        public WorkPath(WorkPath workPath) {

            _WorkPackages = new List<WorkPackage>();
            _ManHour = 0;
            foreach (WorkPackage workpackage in workPath.WorkPackages) {
                _WorkPackages.Add(workpackage);
                _ManHour += workpackage.Requirement.ManHour;
            }
        
        }
        public void addWorkPackage(WorkPackage workPackage) {

            _WorkPackages.Add(workPackage);
            _ManHour += workPackage.Requirement.ManHour;
        }

        public List<WorkPackage> WorkPackages
        {
            get { return _WorkPackages; }
            set { _WorkPackages = value; }
        }
        public WorkPackage getLastWorkPackage() {

            return _WorkPackages.Last();
        }
    }
}